package com.pipe.protocol.events.common;

import com.pipe.protocol.events.BinLogEventHeader;
import io.netty.buffer.ByteBuf;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author Kiven
 */
public class QueryEventPacket {
    private static Logger LOG = LoggerFactory.getLogger(QueryEventPacket.class);

    private BinLogEventHeader eventHeader;
    private QueryEventPostHeader postHeader;
    private QueryEventPayLoad payLoad;

    public QueryEventPacket(BinLogEventHeader eventHeader, QueryEventPostHeader postHeader, QueryEventPayLoad payLoad) {
        this.eventHeader = eventHeader;
        this.postHeader = postHeader;
        this.payLoad = payLoad;
    }

    public static QueryEventPacket build(ByteBuf byteBuf){
        BinLogEventHeader eventHeader = BinLogEventHeader.build(byteBuf);
        QueryEventPostHeader postHeader = QueryEventPostHeader.build(byteBuf);
        QueryEventPayLoad payLoad = null;
        return new QueryEventPacket(eventHeader, postHeader, payLoad);
    }
}